﻿CREATE TABLE [dbo].[ComponenteMeniuriAlimentare] (
    [IDCompMeniu]     INT      IDENTITY (1, 1) NOT NULL,
    [IDMeniu]         INT      NOT NULL,
    [IDArticol]       INT      NOT NULL,
    [Cantitate]       REAL     CONSTRAINT [DF_ComponenteMeniuriAlimentare_Cantitate] DEFAULT ((0)) NOT NULL,
    [IDUnitateMasura] SMALLINT NOT NULL,
    [Calorii]         INT      CONSTRAINT [DF_ComponenteMeniuriAlimentare_Calorii] DEFAULT ((0)) NOT NULL,
    [CodUnitate]      SMALLINT NOT NULL,
    CONSTRAINT [PK_ComponenteMeniuriAlimentare] PRIMARY KEY CLUSTERED ([IDCompMeniu] ASC),
    CONSTRAINT [FK_ComponenteMeniuriAlimentare_Articole] FOREIGN KEY ([IDArticol]) REFERENCES [dbo].[Articole] ([IDArticol]),
    CONSTRAINT [FK_ComponenteMeniuriAlimentare_MeniuriAlimentare] FOREIGN KEY ([IDMeniu]) REFERENCES [dbo].[MeniuriAlimentare] ([IDMeniu]),
    CONSTRAINT [FK_ComponenteMeniuriAlimentare_Unitati] FOREIGN KEY ([CodUnitate]) REFERENCES [dbo].[Unitati] ([CodUnitate]),
    CONSTRAINT [FK_ComponenteMeniuriAlimentare_UnitatiMasura] FOREIGN KEY ([IDUnitateMasura]) REFERENCES [dbo].[UnitatiMasura] ([IDUnitateMasura])
);

